﻿using UnityEngine;

namespace GameFramework.skill.selector.impl
{
    public class SelectPosSkillSelector:ISkillSelector
    {
        public void selectTarget(Skill skill, Transform skillPrefabInstance)
        {
            skill.targetPos.Clear();
            //获取鼠标点
            Ray screenPointToRay = Camera.main.ScreenPointToRay(Input.mousePosition);
            bool raycast = Physics.Raycast(screenPointToRay, out RaycastHit hitInfo);
            if (raycast)
            {
                if (Vector3.Distance(hitInfo.point, skillPrefabInstance.position) <= skill.skillConfig.releaseRange)
                {
                    skill.targetPos.Add(hitInfo.point);
                    Debug.Log("找到目标点："+hitInfo.point);
                }
            }
        }
    }
}